/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package qs.crm.modules.client.cstLost.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://eladmin.vip
* @description /
* @author tong
* @date 2023-06-02
**/
@Entity
@Data
@Table(name="cst_lost")
public class CstLost implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`lst_id`")
    @ApiModelProperty(value = "编号")
    private Long lstId;

    @Column(name = "`lst_cust_no`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "客户编号")
    @JsonSerialize(using = LongToStringUtil.class)
    private Long lstCustNo;

    @Column(name = "`lst_cust_name`")
    @ApiModelProperty(value = "客户姓名")
    private String lstCustName;

    @Column(name = "`lst_cust_manager_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "客户经理编号")
    private Long lstCustManagerId;

    @Column(name = "`lst_cust_manager_name`")
    @ApiModelProperty(value = "客户经理姓名")
    private String lstCustManagerName;

    @Column(name = "`lst_last_order_date`")
    @ApiModelProperty(value = "最后下单时间")
    private Timestamp lstLastOrderDate;

    @Column(name = "`lst_lost_date`")
    @ApiModelProperty(value = "确认流失时间")
    private Timestamp lstLostDate;

    @Column(name = "`lst_delay`")
    @ApiModelProperty(value = "暂缓措施")
    private String lstDelay;

    @Column(name = "`lst_reason`")
    @ApiModelProperty(value = "流失原因")
    private String lstReason;

    @Column(name = "`lst_status`")
    @ApiModelProperty(value = "状态")
    private String lstStatus;

    public void copy(CstLost source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
